﻿using System;
using System.Collections.Generic;
using System.Text;

namespace IceDog.DNL.CSharp.DesignPattern.ChainOfResponsibilityPattern.IceLog
{
    public abstract class AbstractLogger
    {
        protected LogLevel LogLevel { get; set; }
        
        public AbstractLogger NextLogger { get; set; }

        public void LogMessage(LogLevel level, string message)
        {
            if (LogLevel <= level)
            {
                Write(message);
            }
            NextLogger?.LogMessage(level,message);
        }

        protected abstract void Write(string message);
    }
}
